; Music of Pro Ski Simulator (1987) (Codemasters) (Jon Paul Eldridge)
; Ripped by Megachur the 27/02/2009

; Need System Vectors

	write "PROSKISI.BIN"

music_date_rip	equ &1b29
music_adr	equ &8f6e
first_theme	equ 1
last_theme	equ 5	; 1 -> 5

	read "music_header_v1_0.asm"

;
.real_init_music
;
	cp #00
	jr z,l8fda
	dec a
	ld b,#00
	ld c,a
	sla c
	sla c
	sla c
	ld ix,l91c4
	ld b,#00
	add ix,bc
	ld l,(ix+#00)
	ld h,(ix+#01)
	ld (l9138),hl
	ld (l913a),hl
	ld l,(ix+#02)
	ld h,(ix+#03)
	ld (l9128),hl
	ld (l912a),hl
	ld l,(ix+#04)
	ld h,(ix+#05)
	ld (l9118),hl
	ld (l911a),hl
	xor a
	ld (l9117),a
	ld (l911d),a
	ld (l9148),a
	ld (l9127),a
	ld (l912d),a
	ld (l9137),a
	ld (l913d),a
	inc a
	ld (l9149),a
	ld (l911c),a
	ld (l912c),a
	ld (l913c),a
	call #bca7
	ld hl,l913f
	ld bc,#8100
	ld de,l8fea
	jp #bcd7
	defs 2,0
	ret
;
.stop_music
.l8fda
;
	xor a
	ld (l9149),a
	ld hl,l913f
	call #bcdd
	call #bca7
	jp l921b
;
.play_music
.l8fea
;
	push af
	push iy
	xor a
	ld (l913e),a
	ld a,(l912c)
	dec a
	ld (l912c),a
	ld iy,l911e
	call z,l9079
	ld a,(l913c)
	dec a
	ld (l913c),a
	ld iy,l912e
	call z,l9079
	ld a,(l9148)
	cp #00
	jr z,l901b
	dec a
	ld (l9148),a
	ld (l913e),a
.l901b
	ld a,(l911c)
	dec a
	ld (l911c),a
	ld iy,l910e
	call z,l9079
	pop iy
	pop af
	ret
.l902d
	ld l,(iy+#0c)
	ld h,(iy+#0d)
	inc hl
	inc hl
	ld (iy+#0c),l
	ld (iy+#0d),h
	inc ix
	inc ix
	jr l9087
.l9041
	ld a,(iy+#0a)
	ld (iy+#0c),a
	ld a,(iy+#0b)
	ld (iy+#0d),a
	jp l907e
.l9050
	ld a,(ix+#01)
	ld (iy+#01),a
	jr l902d
.l9058
	ld a,(ix+#01)
	ld (iy+#06),a
	jr l902d
.l9060
	ld a,(ix+#01)
	ld (iy+#02),a
	jr l902d
.l9068
	ld a,(ix+#01)
	ld (iy+#05),a
	jp l902d
.l9071
	pop ix
	pop hl
	pop de
	pop bc
	jp l8fda
.l9079
	push bc
	push de
	push hl
	push ix
.l907e
	ld l,(iy+#0c)
	ld h,(iy+#0d)
	push hl
	pop ix
.l9087
	ld b,#ff
	ld a,(ix+#00)
	cp b
	jp z,l9041
	dec b
	cp b
	jr z,l9050
	dec b
	cp b
	jr z,l9058
	dec b
	cp b
	jr z,l9060
	dec b
	cp b
	jr z,l9068
	dec b
	cp b
	jr z,l9071
	cp #7f
	jp nc,l90e3
	ld hl,l914a
	ld a,(ix+#00)
	sla a
	ld b,#00
	ld c,a
	add hl,bc
	ld a,(hl)
	ld (iy+#03),a
	inc hl
	ld a,(hl)
	ld (iy+#04),a
	ld a,(ix+#01)
	ld (iy+#0e),a
	ld l,(iy+#0c)
	ld h,(iy+#0d)
	inc hl
	inc hl
	ld (iy+#0c),l
	ld (iy+#0d),h
	push iy
	pop hl
	ld a,(l913e)
	cp #00
	call z,#bcaa
	pop ix
	pop hl
	pop de
	pop bc
	ret
.l90e3
	ld b,a
	ld a,(iy+#09)
	cp #00
	jr nz,l90ee
	ld a,b
	sub #7f
.l90ee
	dec a
	ld (iy+#09),a
	cp #00
	jp z,l902d
	ld a,(ix+#01)
	sla a
	ld b,#00
	ld c,a
	and a
	push ix
	pop hl
	sbc hl,bc
	ld (iy+#0c),l
	ld (iy+#0d),h
	jp l907e
.l910e
	db #81,#00,#00,#00,#00,#00,#ff,#00
.l911d equ $ + 7
.l911c equ $ + 6
.l911a equ $ + 4
.l9118 equ $ + 2
.l9117 equ $ + 1
	db #00,#00,#00,#00,#00,#00,#02,#00
.l911e
	db #82,#00,#00,#00,#00,#00,#ff,#00
.l912d equ $ + 7
.l912c equ $ + 6
.l912a equ $ + 4
.l9128 equ $ + 2
.l9127 equ $ + 1
	db #00,#00,#00,#00,#00,#00,#02,#00
.l912e
	db #84,#00,#00,#00,#00,#00,#ff,#00
.l913d equ $ + 7
.l913c equ $ + 6
.l913a equ $ + 4
.l9138 equ $ + 2
.l9137 equ $ + 1
	db #00,#00,#00,#00,#00,#00,#02,#00
.l913f equ $ + 1
.l913e
	db #00,#00,#00,#00,#00,#00,#00,#00
.l9149 equ $ + 3
.l9148 equ $ + 2
	db #00,#00,#00,#00
.l914a
	dw #03bc,#0386,#0353,#0324
	dw #02f6,#02cc,#02a4,#027e
	dw #025a,#0238,#0218,#01fa
	dw #01de,#01c3,#01aa,#0192
	dw #017b,#0166,#0152,#013f
	dw #012d,#011c,#010c,#00fd
	dw #00ef,#00e1,#00d5,#00c9
	dw #00be,#00b3,#00a9,#009f
	dw #0096,#008e,#0086,#007f
	dw #0077,#0071,#006a,#0064
	dw #005f,#0059,#0054,#0050
	dw #004b,#0047,#0043,#003f
	dw #003c,#0038,#0035,#0032
	dw #002f,#002d,#002a,#0028
	dw #0026,#0024,#0022,#0020
	dw #0000
.l91c4
	dw l92f6,l94df,l960a
	dw #0000,l9755,l9796,l97eb
	dw #0000,l977f,l97d2,l9817
	dw #0000,l9839,l9850,l9830
	dw #0000,l9830,l9867,l987e
	dw #0000
.l91f0 equ $ + 4
.l91ec
	db #01,#0f,#ff,#01,#01,#0f,#ff,#02
.l91f8 equ $ + 4
.l91f4
	db #01,#0f,#ff,#04,#02,#05,#ff,#0c
.l9203 equ $ + 7
.l91ff equ $ + 3
	db #0a,#ff,#16,#01,#0f,#ff,#06,#02
.l920a equ $ + 6
	db #03,#01,#01,#0b,#ff,#01,#02,#04
.l9211 equ $ + 5
	db #ff,#01,#02,#01,#01,#03,#01,#01
	db #01,#02,#ff,#01,#01,#01,#01
.l921b
	ld hl,l91ec
	ld a,#01
	call #bcbc
	ld hl,l91f0
	ld a,#02
	call #bcbc
	ld hl,l91f4
	ld a,#03
	call #bcbc
	ld hl,l91f8
	ld a,#04
	call #bcbc
	ld hl,l91ff
	ld a,#05
	call #bcbc
	ld hl,l9203
	ld a,#06
	call #bcbc
	ld hl,l920a
	ld a,#01
	call #bcbf
	ld hl,l9211
	ld a,#02
	jp #bcbf
	push ix
	push de
	push bc
	ld c,a
	ld b,#00
	sla c
	sla c
	sla c
	sla c
	ld hl,l9276
	add hl,bc
	call #bcaa
	pop bc
	pop de
	pop ix
	ret
.l9276
	db #81,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #84,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #81,#06,#00,#00,#00,#01,#08,#ff
	db #ff,#00,#00,#00,#00,#00,#00,#00
	db #84,#06,#00,#00,#00,#03,#08,#ff
	db #ff,#00,#00,#00,#00,#00,#00,#00
	db #81,#05,#00,#47,#00,#00,#0f,#ff
	db #ff,#00,#00,#00,#00,#00,#00,#00
	db #84,#05,#00,#8e,#00,#00,#0f,#ff
	db #ff,#00,#00,#00,#00,#00,#00,#00
	db #81,#06,#00,#00,#00,#0d,#08,#ff
	db #ff,#00,#00,#00,#00,#00,#00,#00
	db #84,#06,#00,#00,#00,#0a,#08,#ff
	db #ff,#00,#00,#00,#00,#00,#00,#00
.l92f6
	db #fc,#00,#fb,#00,#fe,#00,#fd,#00
	db #09,#60,#09,#60,#fd,#0f,#fe,#05
	db #21,#0c,#28,#0c,#26,#0c,#24,#06
	db #21,#0c,#21,#06,#28,#0c,#26,#0c
	db #24,#0c,#1f,#0c,#26,#0c,#24,#0c
	db #23,#06,#1f,#0c,#1f,#06,#23,#0c
	db #24,#0c,#26,#0c,#21,#18,#21,#48
	db #1f,#18,#1f,#18,#1f,#18,#1f,#06
	db #1f,#06,#1f,#0c,#21,#18,#21,#18
	db #21,#18,#21,#0c,#21,#0c,#1f,#18
	db #1f,#18,#1f,#18,#1f,#06,#1f,#06
	db #1f,#0c,#fc,#00,#fd,#0f,#fe,#02
	db #21,#0c,#8f,#01,#21,#06,#21,#06
	db #8f,#02,#fe,#03,#21,#18,#21,#0c
	db #24,#0c,#26,#0c,#28,#06,#26,#12
	db #24,#0c,#26,#0c,#26,#0c,#26,#0c
	db #24,#06,#21,#36,#21,#18,#21,#0c
	db #24,#0c,#26,#0c,#28,#06,#26,#12
	db #24,#0c,#26,#0c,#26,#0c,#26,#0c
	db #24,#06,#26,#36,#21,#18,#21,#0c
	db #24,#0c,#26,#0c,#28,#06,#26,#12
	db #24,#0c,#21,#0c,#21,#0c,#21,#0c
	db #24,#0c,#26,#0c,#28,#06,#26,#0c
	db #26,#06,#24,#0c,#81,#10,#fc,#03
	db #2d,#06,#2d,#06,#21,#0c,#21,#0c
	db #2d,#0c,#21,#0c,#21,#0c,#2d,#12
	db #2d,#06,#2b,#06,#2b,#06,#1f,#0c
	db #1f,#0c,#2b,#0c,#1f,#0c,#1f,#0c
	db #2b,#12,#2b,#06,#81,#12,#fe,#04
	db #fc,#01,#09,#60,#07,#60,#05,#60
	db #07,#60,#fe,#03,#fc,#00,#21,#18
	db #21,#0c,#24,#0c,#26,#0c,#28,#06
	db #26,#12,#24,#0c,#21,#0c,#21,#0c
	db #21,#0c,#24,#0c,#26,#0c,#28,#06
	db #26,#12,#24,#0c,#1f,#18,#1f,#0c
	db #23,#0c,#24,#0c,#26,#06,#24,#12
	db #23,#0c,#1f,#0c,#1f,#0c,#1f,#0c
	db #23,#0c,#24,#0c,#26,#06,#24,#12
	db #23,#0c,#21,#18,#21,#0c,#24,#0c
	db #26,#0c,#28,#06,#26,#12,#24,#0c
	db #21,#0c,#21,#0c,#21,#0c,#24,#0c
	db #26,#0c,#28,#06,#26,#0c,#26,#06
	db #24,#0c,#81,#10,#fc,#00,#fb,#00
	db #fe,#00,#fd,#00,#00,#60,#00,#60
	db #fd,#0f,#fe,#05,#2d,#06,#2d,#06
	db #21,#0c,#21,#0c,#2d,#0c,#21,#0c
	db #21,#0c,#2d,#12,#2d,#06,#2b,#06
	db #2b,#06,#1f,#0c,#1f,#0c,#2b,#0c
	db #1f,#0c,#1f,#0c,#2b,#12,#2b,#06
	db #21,#0c,#21,#0c,#24,#0c,#28,#0c
	db #21,#30,#1f,#0c,#1f,#0c,#23,#0c
	db #26,#0c,#1f,#30,#fc,#03,#21,#0c
	db #21,#0c,#24,#0c,#28,#0c,#21,#0c
	db #21,#0c,#24,#0c,#28,#0c,#1f,#0c
	db #1f,#0c,#23,#0c,#26,#0c,#1f,#0c
	db #1f,#0c,#23,#0c,#26,#06,#26,#06
	db #81,#11,#2d,#06,#2d,#06,#21,#0c
	db #21,#0c,#2d,#0c,#21,#0c,#21,#0c
	db #2d,#12,#2d,#06,#2b,#06,#2b,#06
	db #1f,#0c,#1f,#0c,#2b,#0c,#1f,#0c
	db #1f,#0c,#2b,#12,#2b,#06,#81,#12
.l94df equ $ + 1
	db #ff,#fd,#0f,#fc,#00,#fb,#01,#fe
	db #01,#3c,#0c,#fe,#02,#fb,#05,#3c
	db #0c,#fb,#01,#fe,#01,#3c,#06,#3c
	db #06,#fe,#02,#fb,#05,#3c,#0c,#87
	db #0d,#fb,#00,#fe,#05,#fc,#02,#26
	db #18,#24,#48,#24,#18,#23,#18,#24
	db #18,#23,#06,#23,#06,#24,#0c,#26
	db #18,#24,#18,#26,#18,#24,#0c,#26
	db #0c,#24,#18,#23,#18,#24,#18,#23
	db #06,#23,#06,#24,#0c,#fc,#00,#fb
	db #01,#fe,#01,#3c,#0c,#fe,#02,#fb
	db #05,#3c,#0c,#fb,#01,#fe,#01,#3c
	db #06,#3c,#06,#fe,#02,#fb,#05,#3c
	db #0c,#fb,#01,#fe,#01,#3c,#0c,#fe
	db #02,#fb,#05,#3c,#0c,#fb,#01,#fe
	db #01,#3c,#0c,#fe,#02,#fb,#05,#3c
	db #06,#3c,#06,#89,#1a,#fb,#01,#fe
	db #01,#3c,#0c,#3c,#0c,#fb,#01,#fe
	db #01,#3c,#0c,#fe,#02,#fb,#05,#3c
	db #06,#3c,#06,#83,#0b,#fb,#00,#fe
	db #00,#fd,#00,#00,#60,#00,#60,#fd
	db #0f,#fb,#01,#fe,#01,#3c,#0c,#fe
	db #02,#fb,#05,#3c,#0c,#fb,#01,#fe
	db #01,#3c,#06,#3c,#06,#fe,#02,#fb
	db #05,#3c,#0c,#83,#0d,#fb,#00,#fd
	db #0f,#fe,#04,#fc,#01,#21,#60,#1f
	db #60,#1d,#60,#1f,#18,#1f,#18,#1f
	db #18,#1f,#18,#fc,#00,#fb,#01,#fe
	db #01,#3c,#06,#3c,#06,#fe,#02,#fb
	db #05,#3c,#0c,#fb,#01,#fe,#01,#3c
	db #06,#3c,#06,#fe,#02,#fb,#05,#3c
	db #0c,#87,#0e,#fb,#01,#fe,#01,#3c
	db #18,#3c,#0c,#fe,#02,#fb,#05,#3c
	db #0c,#87,#07,#fd,#0f,#fc,#00,#fb
	db #01,#fe,#01,#3c,#0c,#fe,#02,#fb
	db #05,#3c,#0c,#fb,#01,#fe,#01,#3c
	db #06,#3c,#06,#fe,#02,#fb,#05,#3c
.l960a equ $ + 4
	db #0c,#9b,#0d,#ff,#fc,#00,#fb,#00
	db #fd,#0f,#fe,#03,#15,#0c,#1c,#0c
	db #1a,#0c,#18,#06,#15,#0c,#15,#06
	db #1c,#0c,#1a,#0c,#18,#0c,#13,#0c
	db #1a,#0c,#18,#0c,#17,#06,#13,#0c
	db #13,#06,#17,#0c,#18,#0c,#1a,#0c
	db #84,#12,#11,#0c,#18,#0c,#17,#0c
	db #15,#06,#11,#0c,#11,#06,#15,#0c
	db #17,#0c,#18,#0c,#13,#0c,#1a,#0c
	db #18,#0c,#17,#06,#13,#0c,#13,#06
	db #17,#0c,#18,#0c,#1a,#0c,#15,#0c
	db #1c,#0c,#1a,#0c,#18,#06,#15,#0c
	db #15,#06,#1c,#0c,#1a,#0c,#18,#0c
	db #13,#0c,#1a,#0c,#18,#0c,#17,#06
	db #13,#0c,#13,#06,#17,#0c,#18,#0c
	db #1a,#0c,#83,#12,#15,#06,#15,#06
	db #09,#0c,#09,#0c,#15,#0c,#09,#0c
	db #09,#0c,#15,#12,#15,#06,#13,#06
	db #13,#06,#07,#0c,#07,#0c,#13,#0c
	db #07,#0c,#07,#0c,#13,#12,#13,#06
	db #81,#12,#15,#0c,#1c,#0c,#1a,#0c
	db #18,#06,#15,#0c,#15,#06,#1c,#0c
	db #1a,#0c,#18,#0c,#13,#0c,#1a,#0c
	db #18,#0c,#17,#06,#13,#0c,#13,#06
	db #17,#0c,#18,#0c,#1a,#0c,#11,#0c
	db #18,#0c,#17,#0c,#15,#06,#11,#0c
	db #11,#06,#15,#0c,#17,#0c,#18,#0c
	db #13,#0c,#1a,#0c,#18,#0c,#17,#06
	db #13,#0c,#13,#06,#17,#0c,#18,#0c
	db #1a,#0c,#15,#0c,#1c,#0c,#1a,#0c
	db #18,#06,#15,#0c,#15,#06,#1c,#0c
	db #1a,#0c,#18,#0c,#81,#09,#13,#0c
	db #1a,#0c,#18,#0c,#17,#06,#13,#0c
	db #13,#06,#17,#0c,#18,#0c,#1a,#0c
	db #81,#09,#15,#0c,#1c,#0c,#1a,#0c
	db #18,#06,#15,#0c,#15,#06,#1c,#0c
	db #1a,#0c,#18,#0c,#85,#09,#fe,#03
	db #15,#06,#15,#06,#09,#0c,#09,#0c
	db #15,#0c,#09,#0c,#09,#0c,#15,#12
	db #15,#06,#13,#06,#13,#06,#07,#0c
	db #07,#0c,#13,#0c,#07,#0c,#07,#0c
.l9755 equ $ + 7
	db #13,#12,#13,#06,#85,#12,#ff,#fc
	db #02,#fb,#00,#fe,#00,#fd,#0f,#fe
	db #05,#21,#0c,#21,#0c,#24,#0c,#28
	db #0c,#21,#0c,#21,#0c,#24,#0c,#28
	db #0c,#1f,#0c,#1f,#0c,#23,#0c,#26
	db #0c,#1f,#0c,#1f,#0c,#23,#0c,#26
.l977f equ $ + 1
	db #0c,#fc,#02,#fb,#00,#fe,#00,#fd
	db #0f,#fe,#05,#1d,#0c,#1d,#18,#1d
	db #0c,#1f,#18,#1f,#0c,#21,#6c,#fa
.l9796
	db #fd,#0f,#fc,#00,#fb,#01,#fe,#01
	db #3c,#0c,#fe,#02,#fb,#05,#3c,#0c
	db #fb,#01,#fe,#01,#3c,#06,#3c,#06
	db #fe,#02,#fb,#05,#3c,#0c,#fb,#01
	db #fe,#01,#3c,#0c,#fe,#02,#fb,#05
	db #3c,#0c,#fb,#01,#fe,#01,#3c,#06
	db #3c,#06,#fe,#02,#fb,#05,#3c,#06
.l97d2 equ $ + 4
	db #3c,#06,#81,#1b,#fc,#02,#fe,#05
	db #fb,#00,#fd,#0f,#05,#0c,#05,#18
	db #05,#0c,#07,#18,#07,#0c,#09,#24
.l97eb equ $ + 5
	db #09,#18,#09,#30,#fa,#fc,#00,#fb
	db #00,#fd,#0f,#fe,#03,#15,#06,#15
	db #06,#09,#0c,#09,#0c,#15,#0c,#09
	db #0c,#09,#0c,#15,#12,#15,#06,#13
	db #06,#13,#06,#07,#0c,#07,#0c,#13
	db #0c,#07,#0c,#07,#0c,#13,#12,#13
.l9817 equ $ + 1
	db #06,#fc,#00,#fb,#00,#fd,#0f,#fe
	db #03,#21,#0c,#21,#18,#21,#0c,#23
	db #18,#23,#0c,#24,#24,#15,#18,#15
.l9830 equ $ + 2
	db #30,#fa,#fd,#00,#fe,#00,#fb,#00
.l9839 equ $ + 3
	db #00,#60,#ff,#fc,#02,#fb,#00,#fe
	db #00,#fd,#0f,#fe,#05,#1d,#0c,#24
	db #0c,#24,#06,#24,#06,#24,#0c,#29
.l9850 equ $ + 2
	db #30,#fa,#fc,#00,#fb,#00,#fe,#00
	db #fd,#0f,#fe,#05,#21,#0c,#21,#0c
	db #21,#06,#21,#06,#21,#0c,#24,#30
.l9867 equ $ + 1
	db #fa,#fc,#02,#fb,#00,#fe,#00,#fd
	db #0f,#fe,#05,#11,#0c,#18,#0c,#18
	db #06,#18,#06,#18,#0c,#1d,#30,#fa
.l987e
	db #fc,#00,#fb,#00,#fe,#00,#fd,#0f
	db #fe,#05,#15,#0c,#15,#0c,#15,#06
	db #15,#06,#15,#0c,#18,#30,#fa,#00
	db #00,#00,#00
	db #c6
;
.init_music	; added by Megachur
;
	push af
	call l921b
	pop af
	jp real_init_music

;
.game_name
	db "Pro Ski Simulator",0
.game_year
	db "1987",0
.game_publisher
	db "Codemasters",0
.music_author
	db "Jon Paul Eldridge",0
.music_comment
	db "",0

	read "music_end_v1_0.asm"
